package com.onefinger.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.onefinger.repository.IdJsonSerializer;

@Entity
public class Item implements Serializable, Identificable, Cloneable {

	private static final long serialVersionUID = -4211433869527557595L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String name;
	private Long price;
	private String shortDescription;
	private String longDescription;
	private Integer ranking;
	private Integer showOrder;
	private String icon;
	@ManyToOne
	private Subcategory subcategory;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getShowOrder() {
		return showOrder;
	}
	public Long getPrice() {
		return price;
	}
	public void setPrice(Long price) {
		this.price = price;
	}
	public void setShowOrder(Integer showOrder) {
		this.showOrder = showOrder;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	@JsonSerialize(using=IdJsonSerializer.class)
	public Subcategory getSubcategory() {
		return subcategory;
	}
	public void setSubcategory(Subcategory subcategory) {
		this.subcategory = subcategory;
	}
	public String getShortDescription() {
		return shortDescription;
	}
	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}
	public String getLongDescription() {
		return longDescription;
	}
	public void setLongDescription(String longDescription) {
		this.longDescription = longDescription;
	}
	public Integer getRanking() {
		return ranking;
	}
	public void setRanking(Integer ranking) {
		this.ranking = ranking;
	}

	public Item clone()
	{
		Item clone = new Item();
		clone.name = name;
		clone.id = id;
		clone.shortDescription = shortDescription;
		clone.longDescription = longDescription;
		clone.subcategory = subcategory;
		clone.icon = icon;
		clone.price = price;
		clone.ranking = ranking;
		clone.showOrder = showOrder;
		return clone;
		
	}
}
